<?php 
if (!defined('APP_ROOT')) define('APP_ROOT', dirname(__FILE__));
if (!defined('APP_INC')) define('APP_INC', APP_ROOT . '/../../inc/');
if (!defined('APP_LIB')) define('APP_LIB', APP_ROOT . '/../../lib/');

require APP_LIB . '/jaxl/jaxl.php';
		$client = new JAXL(array(
		    'jid' => 'sunxy@qx.tecmold.net',
		    'pass' => 'tec1123'
		));
		
		$client->add_cb('on_auth_success', function() {
			global $client;
			$client->set_status("available!");  // set your status
			$client->get_vcard();               // fetch your vcard
			$client->get_roster();              // fetch your roster list
		});
		
		$client->add_cb('on_chat_message', function($msg) {
			global $client;
	
			// echo back
			$msg->to = $msg->from;
			$msg->from = $client->full_jid->to_string();
			$client->send($msg);
		});
	
		$client->add_cb('on_disconnect', function() {
			_debug("got on_disconnect cb");
		});
		
		$client->start();
		
		?>